function RWestTool(tool){
	if(!tool){return;}
	this.tool=tool;
	this.maplet=null;
	this.isKeepOtherMarker=false;
	
	this.toString=function(){
		return 'RWestTool';
	}
	this.setMaplet=function(maplet){
		if(maplet.toString()!='RMap'){
			window.status='\u4E0D\u80FD\u5BF9'+this.toString()+'\u6DFB\u52A0\u975ERMap\u5BF9\u8C61';
		}
		this.maplet=maplet;
	}
	
	this.tool.root=this;
	this.tool.onclick=function(){
		if(!this.root.maplet){
			window.status=this.root.toString()+'\u5C1A\u672A\u6DFB\u52A0\u5230\u6709\u6548\u7684Toolbox\u3002';
			return;
		}
		this.root.maplet.panWest();
		this.root.notify('onsuccess');
	}
	
	this.turnoff=function(){
		this.notify('onturnon');
	}
	this.clear=function(){}
	
	this.onbegin=new Array();
	this.onsuccess=new Array();	
	this.onturnon=new Array();
	this.onturnoff=new Array();
	
	this.addListener=function(listener,estring){
		switch(estring){
			case 'onbegin':
 				if(listener.onbegin){
 					this.onbegin[this.onbegin.length]=listener;
 				} else{
 					window.status=this.toString()+':\u4E0D\u5408\u6CD5\u7684'+estring+'\u4E8B\u4EF6\u5BF9\u8C61';
 				}
			break;
			case 'onsuccess':
 				if(listener.onsuccess){
 					this.onsuccess[this.onsuccess.length]=listener;
 				} else{
 					window.status=this.toString()+':\u4E0D\u5408\u6CD5\u7684'+estring+'\u4E8B\u4EF6\u5BF9\u8C61';
 				}
			break;			
			case 'onturnon':
 				if(listener.onturnon){
 					this.onturnon[this.onturnon.length]=listener;
 				} else{
 					window.status=this.toString()+':\u4E0D\u5408\u6CD5\u7684'+estring+'\u4E8B\u4EF6\u5BF9\u8C61';
 				}
			break;
			case 'onturnoff':
 				if(listener.onturnoff){
 					this.onturnoff[this.onturnoff.length]=listener;
 				} else{
 					window.status=this.toString()+':\u4E0D\u5408\u6CD5\u7684'+estring+'\u4E8B\u4EF6\u5BF9\u8C61';
 				}
			break;
			default:
				window.status=this.toString()+'\u7C7B\u4E0D\u5B58\u5728'+estring+'\u4E8B\u4EF6';
			break;
		}
	}
	
	this.notify=function(estring){
		switch(estring){
			case 'onbegin':
 				for(var i=0;i<this.onbegin.length;i++){
 					if(this.onbegin[i].onbegin){
 						this.onbegin[i].onbegin();
 					}else{ 
 						window.status=this.toString()+'\u7C7B\u7684\u67D0'+estring+'\u4E8B\u4EF6\u76D1\u542C\u5BF9\u8C61\u635F\u574F';
 					}
 				}
			break;
			case 'onsuccess':
 				for(var i=0;i<this.onsuccess.length;i++){
 					if(this.onsuccess[i].onsuccess){
 						this.onsuccess[i].onsuccess();
 					}else{ 
 						window.status=this.toString()+'\u7C7B\u7684\u67D0'+estring+'\u4E8B\u4EF6\u76D1\u542C\u5BF9\u8C61\u635F\u574F';
 					}
 				}
			break;			
			case 'onturnon':
 				for(var i=0;i<this.onturnon.length;i++){
 					if(this.onturnon[i].onturnon){
 						this.onturnon[i].onturnon();
 					}else{ 
 						window.status=this.toString()+'\u7C7B\u7684\u67D0'+estring+'\u4E8B\u4EF6\u76D1\u542C\u5BF9\u8C61\u635F\u574F';
 					}
 				}
			break;
			case 'onturnoff':
 				for(var i=0;i<this.onturnoff.length;i++){
 					if(this.onturnoff[i].onturnoff){
 						this.onturnoff[i].onturnoff();
 					}else{ 
 						window.status=this.toString()+'\u7C7B\u7684\u67D0'+estring+'\u4E8B\u4EF6\u76D1\u542C\u5BF9\u8C61\u635F\u574F';
 					}
 				}
			break;
			default:
				window.status=this.toString()+'\u7C7B\u4E0D\u5B58\u5728'+estring+'\u4E8B\u4EF6';
			break;
		}
	}
}